package com.haipumi.dao.impl;

import java.sql.SQLException;
import java.util.List;

import com.haipumi.beans.haipumi_chatInfo;
import com.haipumi.dao.DBHelper;
import com.haipumi.dao.IBackChatInfoDao;

public class BackChatInfoDaoImpl implements IBackChatInfoDao {
	
	DBHelper db=new DBHelper();
	@Override
	public List<haipumi_chatInfo> findAllChatInfo() {
		String sql="select * from haipumi_chatinfo ";
		List<haipumi_chatInfo>chatinfolist=null;
		try {
			chatinfolist=db.finds(sql, null, haipumi_chatInfo.class);
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return chatinfolist;
	}

	@Override
	public int countAllChatInfo() {
		String sql="select count(*) from haipumi_chatinfo ";
		int r=0;
		try {
			r=(int) db.findDouble(sql, null);
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return r;
	}

}
